<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRecordsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('records', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('business_id')->nullable();                     //关联相关业务
            $table->integer('department_id')->nullable();                   //关联所属部门
            $table->float('value')->default(0);                       //数据值
            $table->float('score')->default(0)->nullable();           //根据数据值和任务计算出来的得分,即:(时间完成数/计划数)x100
            $table->string('evaluation_result')->nullable();                //根基数据值匹配的评价标准所得出的评价结果
            $table->text('comment')->nullable(true);                  //对业务当前状态的评价
            $table->boolean('is_evaluated_by_hand')->default(false);  //是否手工评价
            $table->boolean('analyzer_id')->default(0);               //手工评价人员ID
            $table->date('record_date')->nullable();                        //数据时间点
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('records');
    }
}
